package com.imooc.controller;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.imooc.pojo.SaveModel;
import com.imooc.pojo.SpiderNoModel;
import com.imooc.service.DumpFileService;
import com.imooc.utils.ExcelUtils;
import com.imooc.utils.URLFecter;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.*;

/**
 * @desc:数据导出api控制器
 * @author: chao
 * @time: 2018.6.11
 */

@Controller
@RequestMapping(value = "/exportdata")
public class ExportDataController {

    static String imageUrl = "https://www.coupang.com/vp/products/%s/items/%s/vendoritems/%s";

    /**
     * @api: /apios/exportdata/excel/
     * @method: GET
     * @desc: 导出数据，生成xlsx文件
     * @param response 返回对象
     * @param date_start 筛选时间，开始(预留，查询时并未做筛选数据处理)
     * @param date_end 筛选时间，结束(预留，查询时并未做筛选数据处理)
     */
    @GetMapping(value = "/excel")
    public void getUserInfoEx(
            HttpServletResponse response,
            @RequestParam String date_start,
            @RequestParam String date_end
    ) {
        try {
//            List<Map<String,Object>> userList = userInfoService.queryUserInfoResultListMap();
//            ArrayList<String> titleKeyList= new ColumnTitleMap("userinfo").getTitleKeyList();
//            Map<String, String> titleMap = new ColumnTitleMap("userinfo").getColumnTitleMap();
//            exportDataService.exportDataToEx(response, titleKeyList, titleMap, userList);
        } catch (Exception e) {
            //
            System.out.println(e.toString());
        }
    }


}